#ifndef __COMMON_DEFINITION__
#define __COMMON_DEFINITION__

#include <QObject>
#include <QDateTime>

#define ADMIN_USER_NAME					"admin"
#define ADMIN_PASSWORD					"123456"

struct OpInfo {
	uint32_t id;

	QString op_name;
	QString op_password;
	QString terminal_name;
	uint32_t op_finger_id;
};

enum {
	TRANS_CATEGORY_1 = 10,
	TRANS_CATEGORY_2 = 20,
	TRANS_CATEGORY_3 = 30,
	TRANS_CATEGORY_4 = 40,
	TRANS_CATEGORY_5 = 50,
	TRANS_CATEGORY_6 = 60,
    TRANS_CATEGORY_7 = 70,
    TRANS_CATEGORY_8 = 80
};
enum {
	TRANS_CLASS_NOTE = 0,
	TRANS_CLASS_COIN = 1
};
enum {
	TRANS_STATUS_NOT_UPLOADED = 0,
	TRANS_STATUS_UPLOADED
};

#define NOTE_TYPE_COUNT					10

struct NoteInfo {
	uint32_t trans_type;

	uint32_t note_count[NOTE_TYPE_COUNT];
	uint32_t total_count;

	uint32_t note_amount[NOTE_TYPE_COUNT];
	uint32_t total_amount;

	uint32_t rejected_count;
};
typedef struct NoteInfo NoteInfo;

struct TransInfo {
	uint32_t id;

	QDateTime date_time;
	QString user_name;
	QString user_alias;
	QString client_name;
	QString terminal_name;
	QString terminal_id;

	NoteInfo note_info;

	uint32_t status;
};
typedef struct TransInfo TransInfo;

struct ClearInfo {
	uint32_t id;

	QDateTime date_time;
	uint32_t note_count;
	uint32_t note_amount;
	uint32_t coin_count;
	uint32_t coin_amount;
	uint32_t amount;
};
typedef struct ClearInfo ClearInfo;

QString NOTE_name(uint32_t note_type_idx);
uint32_t NOTE_factor(uint32_t note_type_idx);

enum {
	MSG_INFO,
	MSG_WARNING,
	MSG_ERROR
};

#define MSG_user_authenticate_fail			1
#define MSG_password_modify_fail			2
#define MSG_user_name_password_empty		3
#define MSG_user_add_fail					4
#define MSG_user_update_fail				5
#define MSG_password_same_fail				6
#define MSG_user_name_exist					7

#define MSG_nc_offline						100
#define MSG_nc_entry_empty					101
#define MSG_nc_reject_not_empty				102
#define MSG_nc_collect_not_empty			103
#define MSG_nc_entry_not_empty				104
#define MSG_nc_collect_empty				105
#define MSG_nc_collect_full					106

#define MSG_waiting_bag_door_open			110
#define MSG_nc_store_started				111
#define MSG_nc_store_success				112
#define MSG_nc_store_failed					113
#define MSG_nc_store_timeout				114

#define MSG_nc_amount_limit					120

#define MSG_bag_sensor_fail					201
#define MSG_bag_door_opened					202
#define MSG_case_door_opened				203

#define MSG_other_errors					701

#endif
